package com.example.javapoint.threads.pool;

public class WorkerThread implements Runnable{
    private String message;

    public WorkerThread(String message) {
        this.message = message;
    }

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + " (Start) message = " + message);
        processMessage(); // 调用processMessage() 方法线程休眠2s
        System.out.println(Thread.currentThread().getName() + " End message");
    }

    private void processMessage() {
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
